
import java.sql.*;
import java.io.*;
import java.util.*;

import javax.swing.*;

public class Phase2 {

    private static BufferedReader buff;
    public static int accnum_count = 0;
    public static int segs = 0;
    public static final HashMap<Integer,Float> weights = new HashMap<Integer,Float>(5,0.95f);
    public static float weighted_vectors[] = {0.04f, 0.8f, 0.3f, 0.6f, 0.9f, 0.7f, 0.3f, 0.76f, 0.87f,
            0.04f, 0.8f, 0.3f, 0.6f, 0.9f, 0.7f, 0.3f, 0.76f, 0.87f,                                    
            0.04f, 0.8f, 0.3f, 0.6f, 0.9f, 0.7f, 0.3f, 0.76f, 0.87f,
            0.04f, 0.8f, 0.3f, 0.6f, 0.9f, 0.7f, 0.3f, 0.76f, 0.87f,
            0.04f, 0.8f, 0.3f, 0.6f, 0.9f, 0.7f, 0.3f, 0.76f, 0.87f
                                                    };

    Phase2() {
    }
    
    public void Sparse_to_Dense(){
        for(int i=0;i<weighted_vectors.length;i++){
        	if(weighted_vectors[i]!=0){
        		weights.put(i+1, weighted_vectors[i]);
        	}
        }
    }
    
    Phase2(int accnum, int max_segs) {
        //throw new UnsupportedOperationException("Not yet implemented");
        accnum_count = accnum;
        segs = max_segs;
    }

    public static void main(String[] args) throws InstantiationException, IllegalAccessException, IOException, SQLException {
        try {
            DBDriver.loadDriver();
            DBDriver.makeConnection();
            Phase2 p = new Phase2();
            p = DBDriver.Calculate_Vector_Array();

            
            /*System.out.println("Enter the weight matrix------ Enter '0' when done");
            String read_seg = "";
            String read_weight = "";
            buff = new BufferedReader(new InputStreamReader(System.in));
            read_in = buff.readLine();
                        
            while(Integer.parseInt(read_in)!=0){
            	System.out.println("Enter the seg : ");
            	read_seg = buff.readLine();
            	System.out.println("Enter the weight for the corresponding segment");
            	read_weight = buff.readLine();
            	weights.put(read_seg,read_weight);
            }
            */
            
            String searchString = "";
            
            while(searchString.equals("")){
                searchString = JOptionPane.showInputDialog(" Enter the String to search");
            }
            DBDriver.retrieveData(searchString);
            DBDriver.closeAll();
        //}
        } catch (InstantiationException instantiationException) {
        }


    }
}
   
